package com.example.vo;


import org.jetbrains.annotations.NotNull;

import java.util.HashMap;
import java.util.Map;

public class CommonReturn {
    private String status;
    private String msg;
    private Map<String, String> data = new HashMap<>(1);

    public CommonReturn(String status, String msg, Map<String, String> data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public CommonReturn() {
    }

    public static @NotNull CommonReturn success(String msg, Map<String, String> data) {
        final CommonReturn result = new CommonReturn();
        result.data = data;
        result.status = "0";
        result.msg = msg;

        return result;
    }

    public static @NotNull CommonReturn error(String msg) {
        final CommonReturn result = new CommonReturn();
        result.status = "-1";
        result.msg = msg;
        return result;
    }

    @Override
    public String toString() {
        return "CommonReturn{" +
                "status='" + status + '\'' +
                ", msg='" + msg + '\'' +
                ", data=" + data +
                '}';
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Map<String, String> getData() {
        return data;
    }

    public void setData(Map<String, String> data) {
        this.data = data;
    }

}
